precision mediump float;

uniform sampler2D vTexture;
varying vec2 vCoordinate;
varying vec4 vColor;
varying vec4 vPosition;

void main() {
    if (vPosition.z == 0.1) {
        gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
    } else if (vPosition.z == 0.2) {
        gl_FragColor = vec4(0.6313, 0.7372, 0.8039, 1.0);
    } else if (vPosition.z == 0.3) {
        float dist = length(gl_PointCoord - vec2(0.5));
        float value = -smoothstep(0.48, 0.5, dist) + 1.0;
        if (value == 0.0) {
            discard;
        }
        gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
    } else {
        // texture
        gl_FragColor = texture2D(vTexture, vCoordinate);
    }
}